package com.jf.blog.controller;

import com.jf.blog.form.vip.VipAuthForm;
import com.jf.blog.form.vip.VipPasswordForm;
import com.jf.blog.form.vip.VipUpdateForm;
import com.jf.blog.service.UserinfoService;
import com.jf.blog.util.ResultJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/vip")
@Api(tags = "会员模块")
public class VipController {
    @Autowired
    private UserinfoService userinfoService;

    @PostMapping("/auth")
    @ApiOperation("会员认证")
    public ResultJson auth(@RequestBody VipAuthForm form) {
        userinfoService.vipAuth(form);
        return ResultJson.success();
    }

    @PostMapping("/update")
    @ApiOperation("修改信息")
    public ResultJson update(@RequestBody VipUpdateForm form) {
        userinfoService.vipUpdate(form);
        return ResultJson.success();
    }

    @PostMapping("/password")
    @ApiOperation("修改密码")
    public ResultJson password(@RequestBody VipPasswordForm form) {
        userinfoService.vipPassword(form);
        return ResultJson.success();
    }

}
